# -*- coding: utf-8 -*-
from PySide6.QtCore import Qt
from PySide6.QtGui import QShortcut, QKeySequence
from PySide6.QtWidgets import QWidget
from windowUI.help_ui import Ui_HelpForm


class HelpWindow(QWidget, Ui_HelpForm):
    def __init__(self):
        super().__init__()
        # 加载UI
        self.setupUi(self)
        # 添加快捷键
        self.ShortcutFun()

    def ShortcutFun(self):
        """
        快捷键 F11 全屏
        快捷键 F5 清屏
        :return:
        """
        # 快捷键 F11
        self.screenStatus = 'Normal'
        # 创建快捷键，不能 通过UI 绑定
        self.screenShortcut = QShortcut(QKeySequence(Qt.Key_F11), self)
        self.screenShortcut.activated.connect(self.WindowSizeFun)
        self.setToolTip('全屏与退出全屏：\n               双击 或者 F11')
        # 快捷键 F5
        # screenShortcut2 = QShortcut(QKeySequence(Qt.Key_F5), self)
        # screenShortcut2.activated.connect(self.CleanFun)

    def WindowSizeFun(self):
        """
        控制窗口尺寸，此处为原大小（最小UI布局）或者全屏
        :return:
        """
        if self.screenStatus == 'Normal':
            self.showFullScreen()
            self.screenStatus = 'FullScreen'
        else:
            self.showNormal()
            self.screenStatus = 'Normal'
